<extend file='resource/view/master'/>
<block name="content">
    <ul class="nav nav-tabs" role="tablist">
        <li><a href="{{u('index')}}">品牌管理</a></li>
        <li class="active"><a href="">编辑品牌</a></li>
    </ul>
    <form class="form-horizontal" id="form" action="" method="post">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">编辑品牌</h3>
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label for="" class="col-sm-2 control-label">品牌名称</label>
                    <div class="col-sm-9">
                        <input type="text" name="bname" required class="form-control" value="{{$oldData['bname']}}">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-sm-2 control-label">品牌排序</label>
                    <div class="col-sm-9">
                        <input type="number" name="sort" required class="form-control" value="{{$oldData['bsort']}}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">是否热门</label>
                    <div class="col-sm-10">
                        <label class="radio-inline">
                            <input type="radio" value="1" name="hot" <if value="$oldData['hot']==1">checked="checked"</if>><i></i> 是
                        </label>
                        <label class="radio-inline">
                            <input type="radio" value="0" name="hot" <if value="$oldData['hot']==0">checked="checked"</if>><i></i> 否
                        </label>
                    </div>
                </div>
<!--                框架上传组件-->
                <div class="form-group">
                    <label for="" class="col-sm-2 control-label">海报图</label>
                    <div class="col-sm-9">
                        <div class="input-group">
                            <input type="text" class="form-control" name="logo" readonly="" value="{{$oldData['logo']}}">
                            <div class="input-group-btn">
                                <button onclick="upImage(this)" class="btn btn-default" type="button" onclick="upImage1(this)">选择图片
                                </button>
                            </div>
                        </div>
                        <div class="input-group" style="margin-top:5px;">
                            <img src="{{$oldData['logo']?:'resource/images/nopic.jpg'}}" class="img-responsive img-thumbnail haibao"
                                 width="150">
                        </div>
                        <span class="help-block">建议大小(宽100高100)</span>
                    </div>
                </div>
            </div>
        </div>
        <input type="hidden" name="bid" value="{{q('get.bid')}}">
        <input type="hidden" name="tid" value="{{q('get.tid')}}">
        <button class="btn btn-primary" type="submit">确定</button>
    </form>

</block>
<script>
    //上传
    function upImage(obj) {
        require(['util'], function (util) {
            util.image(function (images) {
                $("[name='logo']").val(images[0]);
                $(".haibao").attr('src', images[0]);
            }, {})
        })
    }
</script>
